from typing import *


class SingleTon(type):
    """
    单进程内的单例元类
    """
    _instances = {}

    def __call__(cls, *args, **kwargs):
        uid: str = f'{cls.__name__}::{args[0]}'
        if cls._instances.get(uid) is None:
            cls._instances[uid] = super().__call__(*args, **kwargs)
        return cls._instances[uid]


class NullStdout:
    """
    空打印对象 用于关闭控制台打印
    """

    def write(self, *args, **kwargs):
        pass

    def close(self, *args, **kwargs):
        pass

    def flush(self, *args, **kwargs):
        pass



